<script type="text/javascript" src="../../scripts/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
   <script type="text/javascript">
   
					   tinyMCE.init({
						// General options
						auto_focus : true,
						mode : "textareas",
						theme : "advanced",
						plugins : "table,inlinepopups",
				
						// Theme options
						theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,forecolor,backcolor,|,fontselect,fontsizeselect,|,image,removeformat,code",   
						theme_advanced_buttons2 : "",
						theme_advanced_buttons3 : "",
						theme_advanced_buttons4 : "",
						theme_advanced_toolbar_location : "top",
						theme_advanced_toolbar_align : "left",
						theme_advanced_statusbar_location : "none",
						theme_advanced_resizing : true,
				
				
				// Skin options
					skin : "o2k7",
					skin_variant : "silver",
			
					// Example content CSS (should be your site CSS)
					content_css : "css/example.css",
			
					// Drop lists for link/image/media/template dialogs
					template_external_list_url : "js/template_list.js",
					external_link_list_url : "js/link_list.js",
					external_image_list_url : "js/image_list.js",
					media_external_list_url : "js/media_list.js",
			
					// Replace values for the template plugin
					template_replace_values : {
							username : "Some User",
							staffid : "991234"
					}
					
					,setup : function(ed) {
						  ed.onClick.add(function(ed, e) {
							  
							  var cont = ed.getContent(); 
							  
							  if(cont == '<p>Type your reply here ...</p>')
							  {
								  ed.setContent('<span></span>');
							  }
							  
								
								
								 var dom = ed.dom;
								 var doc = ed.getBody();
								 
						  
						         tinyMCE.dom.Event.add(doc, 'blur', function(e) {
									 
									var contents = ed.getContent(); 
									
									if(contents.length < 1 || contents == '<p></p>' || contents == '<span></span>' || contents == '<p>Type your reply here ...</p>')
										{
											ed.setContent('<p>Type your reply here ...</p>');
										}
									else
										{
											
										}
										
								 });
								
							 
						  });
						  
						  
						/* 
								 
								 var dom = ed.dom;
								 var doc = ed.getBody();
								 var contents = ed.getContent();
						  
						         tinyMCE.dom.Event.add(doc, 'blur', function(e) {
									
									if(contents.length < 1 || contents == '<p></p>' || contents == '<span></span>' || contents == '<p>Type your reply here ...</p>')
										{
											ed.setContent('<p>Type your reply here ...</p>');
										}
									else
										{
											
										}
								
							*/
						  
					   } //end first setup
					 
						
				});

   </script>
   

<style>
	textarea.tinymce
	{
    height: 10px;
	}
</style>


<CFQUERY NAME="qryECINCOLLABDISC" DATASOURCE=#client.company_dsn#>
	SELECT SORTID, USERID, DATECREATED, TIMECREATED, MESSAGE, COLLABCODE
	FROM ECINCOLLABDISC
	WHERE COLLABCODE = '#url.collab#'
	ORDER BY SORTID DESC;
</CFQUERY>

<cfoutput>
<table width="50%" align="left" cellspacing="0" padding="35px">

		<!---start--->
        
            <!---<cfquery name="getUserInfo2" datasource="#client.company_dsn#">
                SELECT AVATAR FROM ECRGMYIBOSE
                WHERE PERSONNELIDNO = '#client.CHAPA#'
            </cfquery>--->
        
        <tr>
                <td valign="top" width="3%" rowspan="2" id="info_poster" style="border-bottom: solid 1px ##CCC; background-color: ##FFF; padding: 10px 5px 5px 5px;">
                    <!---<cfif #getUserInfo2.AVATAR# is "NULL" or #getUserInfo2.AVATAR# eq "">
                        <cfset useravatar = "no_avatar.png">
                    <cfelse>
                        <cfset useravatar = #getUserInfo.AVATAR#>
                    </cfif>
                    <img src="#client.image_path#pics201/#useravatar#" width="40px" height="40px"/>--->
                </td>
               
            </tr>
            <tr>
                
                <td width="50%" id="message_poster" valign="top" style="border-bottom: solid 1px ##CCC; background-color: ##FFF; padding: 10px 5px 5px 5px;"  >
                    <table bOrDer="0" width="100%" style="background-color:#client.color_tblset2#;" >
                        <tr >
                            <TD valign="top" width="450px">
                                
                                <form name="frmReadReply" 
                                    action="#getfileFromPath(getBaseTemplatePath())#?id=#URLEncodedFormat(Encrypt(url.id, client.ek))#&collab=#URLEncodedFormat(Encrypt(url.collab, client.ek))#" 
                                    method="post" onsubmit="return Checkb4Submit();">
                                    <textarea name="content" id="elm3" rows="2" cols="100">Type your reply here ...</textarea>
                                    <p><input class="bitbtn" type="submit" name="btnReply" value="Reply To Thread"></p>
                                </form>
                            </TD>
                        </tr>
                    </table>
                    
                </td>
                
            </tr>
        
        <!---end--->


	<cfloop query="qryECINCOLLABDISC">
		<cfquery name="getGUID" datasource="#client.global_dsn#">
			SELECT A.GUID, B.MAINTABLE, B.MAINKEY FROM EGRGUSERMASTER A
            LEFT JOIN #CLIENT.COMPANY_DSN#.CLKUSERTYPE B ON B.USERTYPE = A.USERTYPE 
			WHERE USERID = '#USERID#'
		</cfquery>
		
		<cfquery name="getPIDNO" datasource="#client.company_dsn#">
			SELECT #getGUID.MAINKEY# AS PERSONNELIDNO FROM #getGUID.MAINTABLE#
			WHERE GUID = '#getGUID.GUID#'
		</cfquery>
		
		<cfquery name="getUserInfo" datasource="#client.company_dsn#">
			SELECT AVATAR, SIGNATURE FROM ECRGMYIBOSE
			WHERE PERSONNELIDNO = '#getPIDNO.PERSONNELIDNO#'
		</cfquery>
		<tr>
			<td valign="top" width="3%" rowspan="2" id="info_poster" style="border-bottom: solid 1px ##CCC; background-color: ##FFF; padding: 10px 5px 5px 5px;">
				<cfif #getUserInfo.AVATAR# is "NULL" or #getUserInfo.AVATAR# eq "">
					<cfset useravatar = "no_avatar.png">
				<cfelse>
					<cfset useravatar = #getUserInfo.AVATAR#>
				</cfif>
				<img src="#client.image_path#pics201/#useravatar#" width="40px" height="40px"/>
			</td>
           
		</tr>
		<tr>
        	
			<td width="50%" id="message_poster" valign="top" style="border-bottom: solid 1px ##CCC; background-color: ##FFF; padding: 10px 5px 5px 5px;"  >
				<table bOrDer="0" width="100%" style="background-color:#client.color_tblset2#;" >
					<tr >
						<TD valign="top" width="450px">
							<b>#USERID#<!---#client.firstname# #client.lastname#---></b> &nbsp;&nbsp;
                            
                            <cfset thedate = "#dateformat(DATECREATED, "YYYY-MM-DD")# #timeformat(TIMECREATED, "HH:MM:SS")#" />
                            
                            <cfset ddiff_second = datediff("s", thedate, Now()) />
                            <cfset ddiff_minute = datediff("n", thedate, Now()) />
                            <cfset ddiff_hour   = datediff("h", thedate, Now()) />
                            <cfset ddiff_day    = datediff("d", thedate, Now()) />
                            <cfset ddiff_week   = datediff("w", thedate, Now()) />
                            <cfset ddiff_month  = datediff("m", thedate, Now()) />
                            <cfset ddiff_year   = datediff("yyyy", thedate, Now()) />
                            
                            <span title="#dateformat(DATECREATED, "FULL")# #TIMECREATED#">
                            <cfif ddiff_second LT 60 AND ddiff_minute LT 1 AND ddiff_hour LT 1 AND ddiff_day LT 1 AND ddiff_week LT 1 AND ddiff_month LT 1 AND ddiff_year LT 1>
                                <cfif ddiff_second EQ 60>
                                	<cfoutput>about a minute ago</cfoutput>
                                <cfelse>
                                    <cfoutput>a few seconds ago</cfoutput>
                                </cfif>
								
                            <cfelseif ddiff_minute LT 60 AND ddiff_hour LT 1 AND ddiff_day LT 1 AND ddiff_week LT 1 AND ddiff_month LT 1 AND ddiff_year LT 1>
                            	<cfif ddiff_minute EQ 60>
                                	<cfoutput>about an hour ago</cfoutput>
                                <cfelseif ddiff_minute EQ 1>
                                    <cfoutput>a minute ago</cfoutput>
                                <cfelse>
                                	<cfoutput>#ddiff_minute# minutes ago</cfoutput>
                                </cfif>
                                
                            <cfelseif ddiff_hour LT 24 AND ddiff_day LT 1 AND ddiff_week LT 1 AND ddiff_month LT 1 AND ddiff_year LT 1>
                            	<cfif ddiff_hour EQ 24>
                                	<cfoutput>about a day ago</cfoutput>
                                <cfelseif ddiff_hour EQ 1>
                                	<cfoutput>about an hour ago</cfoutput>
                                <cfelse>
                                	<cfoutput>#ddiff_hour# hours ago</cfoutput>
                                </cfif>
								
                            <cfelseif ddiff_day LT 7 AND ddiff_week LT 1 AND ddiff_month LT 1 AND ddiff_year LT 1>
                            	<cfif ddiff_day EQ 7>
                                	<cfoutput>about a week ago</cfoutput>
                                <cfelseif ddiff_day EQ 1>
                                	<cfoutput>about a day ago</cfoutput>
                                <cfelse>
                                	<cfoutput>#ddiff_day# days ago</cfoutput>
                                </cfif>
								
                            <cfelseif ddiff_week LT 4 AND ddiff_month LT 1 AND ddiff_year LT 1>
                            	<cfif ddiff_week EQ 4>
                                	<cfoutput>about a month ago</cfoutput>
                                <cfelseif ddiff_week EQ 1>
                                	<cfoutput>about a week ago</cfoutput>
                                <cfelse>
                                	<cfoutput>#ddiff_week# weeks ago</cfoutput>
                                </cfif>
								
                            <cfelseif ddiff_month LT 12 AND ddiff_year LT 1>
                            	<cfif ddiff_month EQ 12>
                                	<cfoutput>about a year ago</cfoutput>
                                <cfelseif ddiff_month EQ 1>
                                	<cfoutput>about a month ago</cfoutput>
                                <cfelse>
                                	<cfoutput>#ddiff_month# months ago</cfoutput>
                                </cfif>
								
                            <cfelse>
                            	<cfif ddiff_year EQ 1>
                                	<cfoutput>about a year ago</cfoutput>
                                <cfelse>
                                	<cfoutput>#ddiff_year# years ago</cfoutput>
                                </cfif>
                            </cfif>
                            </span>
                            
						</TD>
					</tr>
				</table>
				 <br /><br />
				#MESSAGE#
			</td>
			
		</tr>
	</cfloop>
    
    
    
</table>
</cfoutput>

